from django.db import models


# Create your models here.
class ClassName(models.Model):
    name = models.CharField(max_length=100, verbose_name="班名")
    pub_date = models.DateTimeField('date published')

    def __str__(self):
        return self.name


class Student(models.Model):
    gender_choices = (
        ("男", "男"),
        ("女", "女"),
        ("保密", "保密"),
    )

    class_name = models.ForeignKey(ClassName, on_delete=models.CASCADE)
    name = models.CharField(max_length=100, verbose_name="姓名")
    gender = models.CharField(choices=gender_choices, verbose_name="性别", max_length=6)
    age = models.SmallIntegerField(verbose_name="年龄")
    study_time = models.DateTimeField(verbose_name="入读时间")

    def __str__(self):
        return self.name

    class Meta:
        db_table = 'student'
        verbose_name = "学生"
        verbose_name_plural = verbose_name
